home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / popupf / fixed.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-03-08  |  4.3 KB  |  157 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Fixed!"
  5.    ClientHeight    =   3060
  6.    ClientLeft      =   1080
  7.    ClientTop       =   1740
  8.    ClientWidth     =   3285
  9.    Height          =   3750
  10.    Icon            =   FIXED.FRX:0000
  11.    Left            =   1020
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   3060
  16.    ScaleWidth      =   3285
  17.    Top             =   1110
  18.    Width           =   3405
  19.    Begin Label Label2 
  20.       Alignment       =   2  'Center
  21.       BackColor       =   &H000000FF&
  22.       BorderStyle     =   1  'Fixed Single
  23.       Caption         =   "Popup Menu5"
  24.       ForeColor       =   &H00FFFFFF&
  25.       Height          =   1335
  26.       Left            =   120
  27.       TabIndex        =   1
  28.       Top             =   1560
  29.       Width           =   3015
  30.    End
  31.    Begin Label Label1 
  32.       Alignment       =   2  'Center
  33.       BackColor       =   &H00800000&
  34.       BorderStyle     =   1  'Fixed Single
  35.       Caption         =   "Popup Menu4"
  36.       ForeColor       =   &H00FFFFFF&
  37.       Height          =   1395
  38.       Left            =   120
  39.       TabIndex        =   0
  40.       Top             =   120
  41.       Width           =   3015
  42.    End
  43.    Begin Menu Menu1 
  44.       Caption         =   "Menu 1"
  45.       Begin Menu Menu11 
  46.          Caption         =   "Make Menu 2 Visible"
  47.          Enabled         =   0   'False
  48.       End
  49.       Begin Menu Menu12 
  50.          Caption         =   "Pop-up Menu 2"
  51.       End
  52.       Begin Menu mSep 
  53.          Caption         =   "-"
  54.       End
  55.       Begin Menu mExit 
  56.          Caption         =   "E&xit"
  57.       End
  58.    End
  59.    Begin Menu Menu2 
  60.       Caption         =   "Menu 2"
  61.       Begin Menu Menu21 
  62.          Caption         =   "Menu 2.1"
  63.       End
  64.       Begin Menu Menu22 
  65.          Caption         =   "Make Menu 2 Invisible"
  66.       End
  67.    End
  68.    Begin Menu Menu3 
  69.       Caption         =   "Menu 3"
  70.       Begin Menu Menu31 
  71.          Caption         =   "Menu 3.1"
  72.       End
  73.       Begin Menu Menu32 
  74.          Caption         =   "Menu 3.2"
  75.       End
  76.       Begin Menu Menu4 
  77.          Caption         =   "Menu 4 (Invis. Popup)"
  78.          Visible         =   0   'False
  79.          Begin Menu Menu41 
  80.             Caption         =   "Menu 4.1"
  81.          End
  82.          Begin Menu Menu42 
  83.             Caption         =   "Menu 4.2"
  84.          End
  85.          Begin Menu Menu43 
  86.             Caption         =   "Menu 4.3"
  87.          End
  88.       End
  89.       Begin Menu Menu5 
  90.          Caption         =   "Menu 5 (Invis. Popup)"
  91.          Visible         =   0   'False
  92.          Begin Menu Menu51 
  93.             Caption         =   "Menu 5.1"
  94.          End
  95.          Begin Menu Menu52 
  96.             Caption         =   "Menu 5.2"
  97.          End
  98.       End
  99.    End
  100. Option Explicit
  101. Sub Form_Load ()
  102.     Left = (Screen.Width - Width) \ 2
  103.     Top = (Screen.Height - Height) \ 2
  104. End Sub
  105. Sub Label1_MouseDown (Button As Integer, Shift As Integer, x As Single, y As Single)
  106.     If (Button = 2) Then
  107.         Popup_Menu Menu4
  108.     End If
  109. End Sub
  110. Sub Label2_MouseDown (Button As Integer, Shift As Integer, x As Single, y As Single)
  111.     If (Button = 2) Then
  112.         Popup_Menu Menu5
  113.     End If
  114. End Sub
  115. Sub Menu11_Click ()
  116.     Menu2.Visible = True
  117.     Menu11.Enabled = False
  118.     Menu22.Enabled = True
  119. End Sub
  120. Sub Menu12_Click ()
  121.     If (Menu2.Visible = False) Then
  122.         Menu2.Visible = True
  123.         MsgBox "Make Menu 2 visible on the main bar if it is available anyway!"
  124.     End If
  125.     Menu22.Enabled = True
  126.     Menu11.Enabled = False
  127.     Popup_Menu Menu2
  128. End Sub
  129. Sub Menu21_Click ()
  130.     MsgBox "Menu 2.1"
  131. End Sub
  132. Sub Menu22_Click ()
  133.     MsgBox "Menu 2.1: Menu 2 will be invisible now."
  134.     Menu11.Enabled = True
  135.     Menu22.Enabled = False
  136.     Menu2.Visible = False
  137. End Sub
  138. Sub Menu41_Click ()
  139.     MsgBox "Menu 4.1!"
  140. End Sub
  141. Sub Menu51_Click ()
  142.     MsgBox "Menu 5.1!"
  143. End Sub
  144. Sub mExit_Click ()
  145.     Unload Me
  146.     End
  147. End Sub
  148. Sub Popup_Menu (m As Menu)
  149. 'Here, I left the other three parameters for PopUpMenu
  150. 'out, since I always use 4 (for example)
  151.     Menu4.Visible = True
  152.     Menu5.Visible = True
  153.     PopupMenu m, 4
  154.     Menu4.Visible = False
  155.     Menu5.Visible = False
  156. End Sub
  157.